<template>
  <view class="content">
    <view class="get-location-select">
      <button @click="getCurrentLocation(0)">自动定位</button>
      <button @click="getCurrentLocation(1)">手动选择</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      title: "Hello",
      tiandituKey: "d1f1141bc29b894b8353083c569e13b2",
    };
  },
  onLoad() {},
  methods: {
    getCurrentLocation(type) {
      if (type == 0) {
        uni.getLocation({
          type: "wgs84",
          success: function (res) {
            console.log("当前位置的经度：" + res.longitude);
            console.log("当前位置的纬度：" + res.latitude);
			},
			fail: err => {
			console.log(err);
		  }
        });
	  } else {
		  uni.navigateTo({
			url:'/pages/LocationSelect/index'
		})
	  }
    },
  },
};
</script>

<style scoped>
.get-location-select {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-around;
}
</style>
